{extend name="../../admin/view/main"}
{block name="content"}
<div class="layui-tab layui-tab-card think-bg-white">
    <form class="layui-form layui-card" action="{:request()->url()}" data-auto="true" method="post" autocomplete="off">
        <div class="layui-card-body">
            <div id="test-editormd">
                <textarea style="display:none;">[TOC]

#### Disabled options

- TeX (Based on KaTeX);
- Emoji;
- Task lists;
- HTML tags decode;
- Flowchart and Sequence Diagram;

#### Editor.md directory

    editor.md/
            lib/
            css/
            scss/
            tests/
            fonts/
            images/
            plugins/
            examples/
            languages/
            editormd.js
            ...

```html
&lt;!-- English --&gt;
&lt;script src="../dist/js/languages/en.js"&gt;&lt;/script&gt;

&lt;!-- 繁體中文 --&gt;
&lt;script src="../dist/js/languages/zh-tw.js"&gt;&lt;/script&gt;
```
</textarea>
            </div>
            <div class="hr-line-dashed"></div>
            {notempty name='vo.id'}<input type='hidden' value='{$vo.id}' name='id'>{/notempty}
            <div class="layui-form-item text-center">
                <button class="layui-btn layui-btn-normal" lay-submit lay-filter="saveData">保存数据</button>
                <button class="layui-btn layui-btn-danger" type='button' data-confirm="确定要取消编辑吗？" data-close>取消编辑</button>
            </div>
        </div>
    </form>
</div>
{/block}
{block name='style'}
<link rel="stylesheet" href="__ROOT__/static/plugs/editormd/css/editormd.css">
{/block}
{block name='script'}

<script>
    //layui.form.render();
    requirejs.config({
        baseUrl: "__ROOT__/static/plugs/editormd/",
        paths: {
            jquery          : "__ROOT__/static/plugs/jquery/jquery.min",
            marked          : "__ROOT__/static/plugs/editormd/lib/marked.min",
            prettify        : "__ROOT__/static/plugs/editormd/lib/prettify.min",
            raphael         : "__ROOT__/static/plugs/editormd/lib/raphael.min",
            underscore      : "__ROOT__/static/plugs/editormd/lib/underscore.min",
            flowchart       : "__ROOT__/static/plugs/editormd/lib/flowchart.min",
            jqueryflowchart : "__ROOT__/static/plugs/editormd/lib/jquery.flowchart.min",
            sequenceDiagram : "__ROOT__/static/plugs/editormd/lib/sequence-diagram.min",
            katex           : "https://cdn.bootcdn.net/ajax/libs/KaTeX/0.11.1/katex.min",
            editormd        : "__ROOT__/static/plugs/editormd/editormd.amd",
        },
        waitSeconds: 30
    });

    var deps = [
        "editormd",
        "__ROOT__/static/plugs/editormd/plugins/link-dialog/link-dialog.js",
        "__ROOT__/static/plugs/editormd/plugins/reference-link-dialog/reference-link-dialog.js",
        "__ROOT__/static/plugs/editormd/plugins/image-dialog/image-dialog.js",
        "__ROOT__/static/plugs/editormd/plugins/code-block-dialog/code-block-dialog.js",
        "__ROOT__/static/plugs/editormd/plugins/table-dialog/table-dialog.js",
        "__ROOT__/static/plugs/editormd/plugins/emoji-dialog/emoji-dialog.js",
        "__ROOT__/static/plugs/editormd/plugins/goto-line-dialog/goto-line-dialog.js",
        "__ROOT__/static/plugs/editormd/plugins/help-dialog/help-dialog.js",
        "__ROOT__/static/plugs/editormd/plugins/html-entities-dialog/html-entities-dialog.js",
        "__ROOT__/static/plugs/editormd/plugins/preformatted-text-dialog/preformatted-text-dialog.js"
    ];

    var testEditor;

    require(deps, function(editormd) {
        //editormd.loadCSS("__ROOT__/static/plugs/editormd/lib/codemirror/addon/fold/foldgutter");
        editormd.loadCSS("__ROOT__/static/plugs/editormd/lib/codemirror/codemirror.min");

        testEditor = editormd("test-editormd", {
            width   : "90%",
            height  : 640,
            syncScrolling : "single",
            path    : "__ROOT__/static/plugs/editormd/lib/",
            pluginPath:"__ROOT__/static/plugs/editormd/plugins/"
        });
    });
</script>
{/block}